package com.changdu.seatunnel.admin.config.model;

import java.util.Date;

import org.slf4j.MDC;

import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

@Getter
@Setter
@Accessors(chain = true)
public class ExceptionResult {

    public ExceptionResult() {
        this.timestamp = new Date();
    }

	public ExceptionResult(String message, Integer status, String error, String path) {
		this.msg = message;
		this.code = status;
		this.error = error;
		this.path = path;
		this.timestamp = new Date();
	}

    private String trace_id = MDC.get("traceId");
    
    /**
     * HttpStatus
     */
    private Integer code; 
    
    /**
     * 业务异常信息
     */
    private String msg;
    
	/**
	 * 默认异常信息
	 */
	private String error;    
    

    /**
     * 异常路径
     */
    private String path;

    /**
     * 异常时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Date timestamp;

}
